<template>
  <div>
    <br>
    <el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange" style="font-size: 10px">
      <el-table-column
          align="center"
          prop="conId"
          label="会诊ID"
          width="100">
      </el-table-column>
      <el-table-column
          align="center"
          prop="title"
          label="标题"
          width="100">
      </el-table-column>
      <el-table-column
          align="center"
          prop="desc"
          label="描述"
          width="80">
      </el-table-column>
      <el-table-column
          align="center"
          prop="contact"
          label="联系人"
          width="50"
      >
      </el-table-column>
      <el-table-column
          align="center"
          prop="phone"
          label="手机号"
          width="100"
      >
      </el-table-column>
      <el-table-column
          align="center"
          prop="address"
          label="城市"
          width="100"
      >
        <template #default="scope">
          {{ scope.row.address }}-
          {{ scope.row.detail }}
        </template>
      </el-table-column>
      <el-table-column prop="img" label="图片" align="center" width="70" >
        <template #default="scope">
          <el-image :src="scope.row.img" style="width: 50px; height: 50px"></el-image>
        </template>
      </el-table-column>
      <el-table-column prop="money" label="悬赏金" align="center" width="80">
      </el-table-column>
      <el-table-column prop="conStatus" label="订单状态" align="center" width="50">
        <template #default="scope">
          {{scope.row.conStatus==0 ? '待接诊' : scope.row.conStatus==1 ? '已接诊' : '已完成'}}
        </template>
      </el-table-column>
      <el-table-column prop="createTime" label="发起时间" align="center" width="80">
      </el-table-column>
      <el-table-column prop="startTime" label="接诊时间" align="center" width="80">
      </el-table-column>
      <el-table-column prop="endTime" label="完成时间" align="center" width="80">
      </el-table-column>
      <el-table-column prop="recordStatus" label="问诊状态" align="center" width="50">
        <template #default="scope">
          {{scope.row.recordStatus===0?'待回复' : scope.row.recordStatus===1 ? '沟通中' :scope.row.recordStatus===2 ? '已结束' : '待接诊'}}
        </template>
      </el-table-column>
      <el-table-column prop="phName" label="医师名称" align="center" width="60">
      </el-table-column>
      <el-table-column prop="userName" label="客户名称" align="center" width="60">
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button v-show="scope.row.conStatus!=0"
              size="mini"
              type="text"
              @click="detail(scope.row)"
          >详情
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {backgroundRecord,ReplyById} from "../api/Consult"
export default {
  data() {
    return {
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      tableData: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    }
  },
  created() {
    this.getList();
  },
  methods: {
    detail(item){
      this.$router.push({path:'/RecordDetail',query:{from:item}})
    },
    handleSelectionChange() {

    },
    handleUpdate() {

    },
    getList(){
      backgroundRecord().then(res => {
        if(res.code === 200){
          this.tableData = res.data
          console.log(this.tableData)
        }
      })
    }
  }
}
</script>

<style>

</style>
